package com.jinkaimen.kqb.factory;


import android.os.Bundle;
import android.util.SparseArray;

import com.ht.baselibs.ui.base.BaseFragment;
import com.jinkaimen.kqb.ui.fragment.GetMoneyFragment;
import com.jinkaimen.kqb.ui.fragment.NotifyFragment;
import com.jinkaimen.kqb.ui.fragment.SelfNewFragment;
import com.jinkaimen.kqb.ui.fragment.ShareFragment;
import com.jinkaimen.kqb.ui.fragment.TextFragment;
import com.jinkaimen.kqb.ui.fragment.h5toapp.HomeFragment;


public class FragmentFactory {

    public static final int FRAGMENT_HOME_TAB0 = 0;

    public static final SparseArray<BaseFragment> mHomeTabMap = new SparseArray();

    public static BaseFragment getHomeTabFragment(int position) {
        BaseFragment fragment = mHomeTabMap.get(position);

        if (fragment == null) {
            switch (position) {
                case 0:
                    fragment = new HomeFragment();
                    break;
                case 1:
                    fragment = new GetMoneyFragment();
                    break;
                case 2:
                    fragment = new ShareFragment();
                    break;
                case 3:
                    fragment = new NotifyFragment();
                    break;
                case 4:
                    fragment = new SelfNewFragment();
                    break;
                case 5:
                    fragment = new TextFragment();
                    break;
                default:
            }
            mHomeTabMap.put(position, fragment);
            Bundle bundle = new Bundle();
            bundle.putBoolean(BaseFragment.IS_ATTACH_FRAGMENT_LAYOUT, true);
            if (fragment != null)
                fragment.setArguments(bundle);
        }
        return fragment;
    }
}
